/** 插件 * */
import VXETable from "vxe-table";
import "vxe-table/lib/style.css";
import "xe-utils";
import SearchTree from 'vue-search-tree';
import Setting from "../setting";

/** 全局组件 * */
import basicLayout from '@/components/globalComp/basicLayout'; // 页面布局
import fullLoading from "@/components/globalComp/fullLoading"; // 全屏loading
import fullscreenModal from "@/components/globalComp/fullscreenModal"; // 全屏弹框
import detail from "@/components/table/detail.vue"; // 详情
import vTable from "@/components/table/index.vue"; // 详情
import uploadCom from  "@/components/upload/index"; // 本地附件上传
import iUploadCom from  "@/components/upload/index0"; // i国网附件上传
import treeSelect from '@/components/globalComp/treeSelect'; // 树结构选择
import queryPopup from '@/components/globalComp/queryPopup'; // 筛选条件弹框
import moveBtn from '@/components/globalComp/moveBtn'; // 可移动悬浮按钮
window.smMid = '81C5CAE653E6FDA7C60ABDBCC6';

export default {
  install(Vue) {
    // 插件
    Vue.use(VXETable);
    Vue.use(SearchTree);
    // 全局组件注册
    Vue.component("basicLayout", basicLayout);
    Vue.component("fullLoading", fullLoading);
    Vue.component("fullscreenModal", fullscreenModal);
    Vue.component("detail", detail);
    Vue.component("vTable", vTable);
    Vue.component("uploadCom", Setting.codeMode === "develop" ? uploadCom : iUploadCom);
    Vue.component('treeSelect', treeSelect);
    Vue.component('queryPopup', queryPopup);
    Vue.component('moveBtn', moveBtn);
    window.priBegin = 'a0e914d434f01de3af490';
  },
};

// 日期格式化
Date.prototype.format = function (fmt) {
  var o = {
    "M+": this.getMonth() + 1, // 月份
    "d+": this.getDate(), // 日
    "h+": this.getHours(), // 小时
    "m+": this.getMinutes(), // 分
    "s+": this.getSeconds(), // 秒
    "q+": Math.floor((this.getMonth() + 3) / 3), // 季度
    S: this.getMilliseconds(), // 毫秒
  };
  if (/(y+)/.test(fmt))
    fmt = fmt.replace(
      RegExp.$1,
      (this.getFullYear() + "").substr(4 - RegExp.$1.length)
    );
  for (var k in o)
    if (new RegExp("(" + k + ")").test(fmt))
      fmt = fmt.replace(
        RegExp.$1,
        RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length)
      );
  return fmt;
};
